﻿@namespace AbpAntDesignBlazorServer
@inherits AntDomComponentBase

<Space Class="@ClassMapper.Class">

    @if (CurrentUser.IsAuthenticated)
    {
        <SpaceItem>
            <NoticeIcon ClearText="清空"
                        ViewMoreText="查看更多"
                        Count="_count"
                        OnClear="HandleClear"
                        OnViewMore="HandleViewMore">
                <NoticeList TabKey="notification"
                            Title="通知"
                            EmptyText="你已查看所有通知"
                            ShowViewMore
                            Data="_notifications" />
                <NoticeList TabKey="message"
                            Title="消息"
                            EmptyText="您已读完所有消息"
                            ShowViewMore
                            Data="_messages" />
                <NoticeList TabKey="event"
                            Title="待办"
                            EmptyText="你已完成所有待办"
                            ShowViewMore
                            Data="_events" />
            </NoticeIcon>
        </SpaceItem>
        <SpaceItem>
            <AbpAntDesignBlazorServer.AvatarDropdown Name="@CurrentUser.Name" Avatar="@UserAvatar" OnItemSelected="HandleSelectUser" />
        </SpaceItem>
    }
    else
    {
        <SpaceItem>
            <AntDesign.Button Type="primary" Shape="round" Icon="login" Size="small" OnClick="OnClickLogin">@L["Login"]</AntDesign.Button>
        </SpaceItem>
    }
    @if (SettingState.Value.IsDisplaySearch)
    {
        <SpaceItem>
            <HeaderSearch Class="action search"
                          Placeholder="站内搜索"
                          DefaultValue="umi ui"
                          Options="DefaultOptions" />
        </SpaceItem>}
    @*样式设置*@
    <SpaceItem>
        <div @onclick="Toggle" style="cursor:pointer;"><AntDesign.Icon Type="setting" Theme="outline" /></div>
    </SpaceItem>
    @if (SettingState.Value.IsDisplayHelp)
    {
        <SpaceItem>
            <AntDesign.Tooltip Title="@("Help")" Placement="@PlacementType.Bottom">
                <span class="action">
                    <AntDesign.Icon Type="question-circle" Theme="outline" />
                </span>
            </AntDesign.Tooltip>
        </SpaceItem>
    }
    @if (IsMultiLanguage)
    {
        <SpaceItem>
            <SelectLang OnItemSelected="HandleSelectLang" Locales="Locales" LanguageLabels="LanguageLabels" LanguageIcons="LanguageIcons" />
        </SpaceItem>
    }
</Space>
<AbpAntDesignBlazorServer.SettingDrawer @ref="child" />
@code{

    void Toggle()
    {
        child.SetShow(new MouseEventArgs());
    }
    SettingDrawer child;
}
